# Maintainer: Renoir Boulanger <hello@renoirboulanger.com>
pkgname=php7-pecl-yaml
_pkgreal=yaml
pkgver=2.1.0
pkgrel=2
pkgdesc="YAML syntax bindings for PHP"
url="https://pecl.php.net/package/yaml"
arch="all"
license="MIT"
makedepends="php7-dev autoconf re2c yaml-dev"
depends="php7-common"
# Set source file explicitly, otherwise extracted archive directory breaks the build.
source="$pkgname-$pkgver.tgz::https://pecl.php.net/get/$_pkgreal-$pkgver.tgz
	32bit.patch"
builddir="$srcdir/$_pkgreal-$pkgver"
provides="php7-yaml=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-yaml" # for backward compatibility

build() {
	phpize7
	./configure \
		--prefix=/usr \
		--with-php-config=php-config7
	make
}

# Thanks to @TBK for https://github.com/php/pecl-file_formats-yaml/pull/29
check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	install -d $pkgdir/etc/php7/conf.d
	echo "extension=$_pkgreal.so" > $pkgdir/etc/php7/conf.d/70_$_pkgreal.ini
}

sha512sums="3731ca2b84e80599d7fae4f58efdd11e9920c672ea6e62ff6b0d57d721d3f6f12ca86efe88f63c324d4ad2b73d6947a21f6e5a47263538ca0d5e822b8fc7b8bd  php7-pecl-yaml-2.1.0.tgz
1707d8d3c4d1f003bf2ab1e04bbcacd73d3ecfa94377bdb0d870d775c820a2b1a180147033208754977652c8c11860e2a1703fd6b0acc997c4bacc612be5737a  32bit.patch"
